﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Suspiros_Persistencia;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace SuspirosWeb
{
    public partial class Formulario_web120 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=suspirosdb;Persist Security Info=True;User ID=sa;Password=itson");
            dsOrdenes ds = new dsOrdenes();
            string sql = "SELECT        dbo.carritos.id, dbo.usuarios.nombre, dbo.usuarios.apellidoP, dbo.usuarios.apellidoM, dbo.ordenes.id AS Expr1, dbo.ordenes.fechaCompra, ";
            sql += "   dbo.ordenes.status";
            sql += " FROM            dbo.carritos INNER JOIN";
            sql += " dbo.usuarios ON dbo.carritos.id = dbo.usuarios.id INNER JOIN";
            sql += " dbo.ordenes ON dbo.carritos.id = dbo.ordenes.id;";
            SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
            adapter.Fill(ds.ordenesview);
            RPTOrdenes rpt = new RPTOrdenes();
            rpt.SetDataSource(ds);

            CrystalReportViewer1.ReportSource = rpt;
        }
    }
}